home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS09.ADF / MyCLI / MyCLI.DOC < prev    next >
Text File  |  1986-05-22  |  17KB  |  363 lines

  1.  
  2. MyCLI, a command line interpreter and its history.
  3. -------------------------------------------------
  4.  
  5. Version 1.00 by Mike Schwartz. ( Posted December 1985 )
  6. 344 Fay Way, Mt. View, CA 94043
  7.  
  8. Version 1.01 by Rick Wirch     ( added line editing, redirection, etc. )
  9. 1009 Vilas Ave. #2, Madison, WI 53715
  10.  
  11. Version 1.02 by D.J. James     ( added phase of moon to date )
  12. Version 1.03 and Version 2.0 by Rick Wirch ( revised until May 86 )
  13.  
  14.  
  15. Overview
  16. --------
  17.  
  18.    MyCLI is a command shell interpreter, intended as a substitute for the
  19. AmigaDOS Command Line Interpreter.  It has twenty four built-in commands
  20. such as 'dir', 'delete', 'type', 'cd' and 'copy'.  Since these programs are
  21. internal to MyCLI, you do not need a Workbench diskette inserted in any
  22. drive to perform these tasks.  The other alternative to using MyCLI is to
  23. copy commands into the RAM:  disk device.  Copying all the commands MyCLI
  24. provides into the RAM:  disk would use 60688 bytes.
  25.     MyCLI is only 17580 bytes long, and provides many features that make
  26. the CLI much easier to use such as command line editing.
  27.  
  28.    The command line editing uses the arrow keys, delete, backspace, and has
  29. overstrike or insert modes.  MyCLI also remembers the last sixteen
  30. commands, which can be recalled with the up and down arrow keys.  This
  31. allows reuse of commands without re-typing.
  32.  
  33.    Another ability of MyCLI is its user definability.  It allows you to
  34. define up to twenty commands for the function keys and shifted function
  35. keys.  Once a function key is defined your favorite command is just a
  36. keystroke away! MyCLI also lets you define a command search path.  Now
  37. commands can reside in areas other than the current directory or in the 'C'
  38. ( command ) directory of the disk you booted with.
  39.    Finally, it lets you define the string for your prompt ( including the
  40. current path ), and the character used to chain multiple commands together
  41. on a single line.  All of these definable features can be set to your
  42. liking in a file called 'AUTOEXEC.BAT' that will be executed when MyCLI
  43. starts up.
  44.  
  45.    It has an optional internal terminal program as well, with ASCII file
  46. send and receive, and ANSI terminal compatibility.  Unfortunately, I do not
  47. have a modem and the code is relatively untouched from the original version
  48. by Mike Schwartz.  Therefore, I cannot account for its abilities or
  49. inabilities.  The reports I have heard from people who have beta tested
  50. MyCLI is that MyCLI is easily overrun at 1200 baud.
  51.  
  52.    That is why there are two versions of MyCLI on the AMICUS #9 disk.  One
  53. has all of the modem commands and abilities included and the other does
  54. not.  Personally, I would rather use one of the public domain modem
  55. programs on the other AMICUS disks for going online and use MyCLI as a CLI
  56. replacement only.
  57.  
  58.    The program can be found on AMICUS disk #9 or the executable can be
  59. found in the AMIGA sections on the PeopleLink or CompuServe networks.
  60. Because of the excessive length of the source code, 54966 bytes, it will
  61. not be found in this magazine.
  62.  
  63.    To use this program you must invoke it from the command line interface
  64. (CLI).  I recommend copying it to your 'c' directory on your boot disk, so
  65. MyCLI becomes a built-in command.  I also recommend typing "run MyCLI" as
  66. opposed to typing "MyCLI" so that the plain CLI still works.
  67.  
  68. Command line editing
  69. --------------------
  70.  
  71.    Cursor left and right move the cursor left and right through the
  72. currently typed characters on the command line.  Shift of the cursor left
  73. and right move to the beginning and end of the line, respectively.  The
  74. delete key deletes the character under the cursor, and backspace deletes
  75. the character to the left of the cursor and moves the rest of the line
  76. left.
  77.  
  78.    The TAB key or CTRL-A ( for you VMS users ) toggles insert/overstrike
  79. mode.  The default mode is overstrike mode, so any characters typed in the
  80. middle of a line overstrike the present characters.  TAB changes to insert
  81. mode, where newly typed characters are inserted into the command line
  82. string at the current cursor position.
  83.  
  84.    The ESC key and CTRL-X are both 'kill' characters and will erase the
  85. current command line.
  86.  
  87.    Cursor up and down recall the previous sixteen command lines.  This is a
  88. simple 'history' function.  These previous commands may be edited as if
  89. they were just typed at the keyboard.  Thus a command involving a long path
  90. could be recreated with a new file by simply hitting cursor up, cursoring
  91. to the file name and entering in the new file name in the same path.
  92.  
  93.  
  94. .CLI files, .BAT files, and MyCLI search paths
  95. ----------------------------------------------
  96.  
  97.    When a new command is typed and return is pressed, the first word in the
  98. line is the command name.  AmigaDOS would search the current directory,
  99. then the C:  directory, for a program file with this name.
  100.  
  101.    MyCLI will first search its internal list of twenty-two commands for the
  102. command name.  If it is not found in the internal list it will search for 
  103. a file with the command name, and a '.BAT' extension in the current 
  104. directory.  If this file is found, it is executed in a similar fashion as 
  105. the MyCLI AUTOEXEC.BAT batch file.  (See below.)
  106.  
  107.    If no '.BAT' file is found, MyCLI next searches for a file with the
  108. extension '.CLI' in the current directory.  If this file is found, it is
  109. sent to AmigaDOS, as if 'EXECUTE commandname.CLI' was typed.
  110.  
  111.    Finally, if no '.CLI' file is found, the command is searched for in the
  112. user defined search path.  This user defined search path consists of paths
  113. or complete directory desriptions separated by semi-colons.  If the path
  114. ends in a directory name it must have a trailing '/' ( slash ).  The '.' 
  115. ( period ) is reserved to mean the current directory.  The command search
  116. path is searched from left to right and the first path where the command is
  117. found is used.
  118.  
  119.    To make life easier for single drive MyCLI users I have copied the 'Run'
  120. command into the RAM: disk, and assigned the default place for commands to
  121. be the 'C' directory in the RAM: disk.  If you have a program that fails
  122. because it cannot find a command enter this line, "assign C: SYS:C".  Also
  123. if you dislike MyCLI's versions of 'delete' and 'copy' enter these lines.
  124. "copy SYS:C/Copy RAM:C", "copy SYS:C/Delete RAM:C"
  125. Now, if you type 'copy' MyCLI copies using its internal command, and if you
  126. type 'Copy' MyCLI copies using the command in the RAM: disk.  The same goes
  127. for any commands typed using any upper case letters.
  128.  
  129. AUTOEXEC.BAT file
  130. -----------------
  131.  
  132.    If a file named AUTOEXEC.BAT is found in the current directory when
  133. MyCLI starts, it is executed immediately.  For example, this file might
  134. change the prompt string to your liking, and define your function keys.
  135.    This file can contain both MyCLI commands and AmigaDOS commands, but
  136. don't try to use IF, SKIP, .KEY, or any other batchfile commands because
  137. they will not work correctly.
  138.  
  139.  
  140. Help
  141. ----
  142.  
  143. To see a list of MyCLI commands, press the Help key.
  144.  
  145.  
  146. Internal MyCLI commands                            Example
  147. -----------------------                         -------------
  148.  
  149. >        redirect command output                dir opt a > filename
  150.  
  151. <        redirect command input                 myprog < inputfile
  152.  
  153.       The file redirection can now be at any place within the command
  154.    string, unlike AmigaDOS. Unfortunately the '<' does not work entirely
  155.    and I have been stymied for weeks how to correct the problem.  The
  156.    problem lies within the AmigaDOS Execute() command (for you programmers
  157.    out there) and I am sure you know what an awful mess that function is
  158.    if you have ever used it.
  159.       Within the AmigaDOS Execute() function also lies one of the bugs
  160.    that MyCLI has.  Actually it is not a bug but a strange quirk.  If
  161.    you type a command that is not internal to MyCLI, and that command
  162.    requires you to type in some information, you have to select the window
  163.    MyCLI was spawned from, press <RETURN>, and type the input in that 
  164.    window.  The output will occur on the MyCLI window though.  If anyone 
  165.    knows how to cure this, please send a update, I know quite a few people 
  166.    who have this same problem with other programs.
  167.  
  168. cd       change current directory               cd df1:source
  169.  
  170.       The cd command in MyCLI also understands the meaning of leading
  171.    slashes in a directory name.  For example if you are in the directory
  172.    df0:include/exec/update and you type 'cd //devices' you will end up two
  173.    levels higher, in the directory df0:include/devices.
  174.  
  175. copy     copy a file                            copy df0:c/diskcopy ram:c
  176.  
  177.       This command works significantly faster than the AmigaDOS copy
  178.    command.  It uses as large a buffer as possible to copy the file.
  179.    It also works like MS-DOS 'copy', because using one parameter copies a
  180.    file to the same name, in the current directory, unlike AmigaDOS 'copy'.
  181.    Either filename can be '*', to specify the console, and the devices PRT:,
  182.    SER:, PAR:, CON: are allowed.  The copy command does not allow patterns
  183.    ( wild carding ), or the keyword 'all' though.
  184.    (Also, if you have not weaned yourself from using the 'FROM' and 'TO'
  185.    keywords with the AmigaDOS 'copy' command, this command will understand.)
  186.  
  187. date     display the date                       date
  188.  
  189.       Date shows the date, the day of the week, and the phase of the moon.
  190.    This command was reworked and the phase of the moon was added by D.J.
  191.    James.  It does not display the time, or allow you to set the date or 
  192.    time.  To set the date or time use 'Date', the AmigaDOS version.
  193.  
  194. define   set a function key definition          define f1 dir ram:
  195. def      " "                                    def f2 run online cis
  196.  
  197.       There are twenty user-definable function keys, from f1 to f20.
  198.    The functions f11 through f20 refer to SHIFTed function keys.  To
  199.    remove a function key definition type 'define f#', where # is the number
  200.    of the function key to remove.
  201.  
  202. delete   delete a file                          delete df1:mydir/myfile
  203. del      " "                                    del bah.c
  204.  
  205.       Delete deletes a file, but does not allow any patterns or wildcarding
  206.    in the file to be deleted.  It also does not allow multiple file names to
  207.    be specified or the keyword 'all'.
  208.  
  209. dir      directory listing                      dir df1:include opt a
  210. ls       " "                                    ls df0:mydir
  211.  
  212.       The 'dir' and 'ls' commands can use either the 'opt a' or the '-r'
  213.    keywords to recurse down any subdirectories encountered in the specified
  214.    or the current path.  You cannot use the keywords 'opt i' or 'opt d'.
  215.    (Yes, you can say 'ls opt a', or 'dir -r', for that matter.)
  216.  
  217. endcli   exit to the previous CLI               endcli
  218.  
  219. help     display simple help listing            help
  220.  
  221. list     directory listing                      list ram:
  222.  
  223.       List gives all the information about a file like the 'List' command
  224.    in AmigaDOS, but it cannot recurse down directories.  It also cannot
  225.    use the keywords 'PAT', 'KEYS', 'DATES', 'NODATES', 'QUICK', etc. to
  226.    change the way this information is displayed.
  227.  
  228. makedir  make a new directory                   makedir RAM:C
  229. md       " "                                    md examples
  230.  
  231. more     view a text file, a page at a time     more mycli.c
  232.  
  233.       The <SPACEBAR> will advance the listing by a page, the RETURN key
  234.    will advance the listing a line at a time, and ESCAPE or CTRL-C will
  235.    cancel the listing immediately.
  236.  
  237. rename   rename a file or subdirectory          rename documents as texts
  238. mv       " "                                    mv file.c backup.c
  239.  
  240. newcli   birth another MyCLI task               newcli 0 0 640 200 2
  241.  
  242.       New MyCLI task windows will appear on the right side, with each
  243.    new window slightly higher than the previous window if no parameters
  244.    are given.  If parameters are given they are the X position, Y position,
  245.    width, height, and MyCLI id or process number.  If MyCLI is started 
  246.    with a process number other than '1' it will not copy 'run' into the
  247.    RAM: disk, and it will not assign C: to the RAM: disk. 
  248.  
  249. set      set system variables                   set prompt = $e[1;32m$p> $n
  250.  
  251.       The variables are 'path', 'prompt', and 'chain'.  If you just type
  252.    set path<RETURN> or set 'variable'<RETURN> the current value of the
  253.    variable is displayed.  If you type a string after the variable name
  254.    ( the '=' is optional ) that string is copied into the variable you
  255.    specified.
  256.       The 'path' variable is a string defining the command search path.
  257.    That is, when a command is to be executed it is searched for in all the
  258.    directories from left to right in the search path.
  259.       The 'chain' variable is the character used to separate several
  260.    commands on the same line.
  261.       See the discussion of prompt expansion strings below.
  262.  
  263. setcomment  set the comment on a file           setcomment foo.c A comment.
  264.  
  265. time     show current time                      time
  266.  
  267. type     type a file, without pausing.          type hackhack.txt
  268.  
  269.       This command sends a file to the standard output, which can be
  270.    redirected, the <SPACEBAR> can be used to start/stop the display and
  271.    ESC or CTRL-C can be used to abort the command at any time.
  272.  
  273. whatis   convert AmigaDOS error code to text    whatis 203
  274.  
  275. -----------------------------------------------------------------------
  276. If the internal modem program is enabled, these additional commands are
  277. available.  (Please note that the modem program code is removed from
  278. some versions of MyCLI, to save space.)
  279.  
  280. terminal    enter dumb terminal mode
  281. online      " "
  282.  
  283.       CTRL-C will allow you to re-enter MyCLI and enter one command, after
  284.    that command is completed you will go back into terminal mode.  If you
  285.    do not see what you are typing, you can type CTRL-E to toggle local
  286.    echoing.  This feature is useful when you are connected to another
  287.    personal computer that does not echo characters back to you.
  288.  
  289. offline     terminate modem communication
  290.  
  291. capture     begin/end ASCII file capture, that is 'capture' is a toggle.
  292.  
  293. The 'type' command will send a file over the communications port
  294. as well as display it on the screen.
  295.  
  296.  
  297. Prompt string escapes
  298. ---------------------
  299.  
  300. MyCLI understands several prompt string escapes which begin with a '$'.
  301. Here are the available escapes.  They may be in upper- or lower-case.
  302.  
  303.    $b       backspace      prints a destructive backspace character
  304.  
  305.    $d       date           14-May-86
  306.  
  307.    $e       escape char    ^[, the ASCII escape character.
  308.  
  309.       This may be used to change text color or video mode, or underlines,
  310.    italics, bold, etc. using ANSI video escape sequences.
  311.  
  312.    $n       normal video   change text back to normal video
  313.  
  314.    $p       path           This expands to the current path string.
  315.  
  316.       Note that this is the path as understood by MyCLI.  If you switch
  317.    disks in DF1:, the path string will stay the same.  If you type 'dir',
  318.    it will request the first disk.
  319.  
  320.    $r       reverse video  change text to reversed or inverse video
  321.  
  322.    $t       time           This expands to the time, 13:24:56.
  323.  
  324.    $v       version        This expands to the version of MyCLI.
  325.                            This is currently "MyCli rev. 2.0".
  326.  
  327.    $_       newline        This expands to the newline character.
  328.  
  329.  
  330. For example, the default MyCLI prompt is:
  331.  
  332.    $e[1;32m$p> $n
  333.  
  334. This displays a prompt in boldface color 3, followed by the current path,
  335. and then a '>'.  The video is returned to normal colors.
  336.  
  337.  
  338. Credits
  339. -------
  340.  
  341.    The development of MyCLI is indebted to Mike Schwartz, who wrote a simple
  342. command line interpreter replacement.  The source code retains his
  343. authorship message.  His internal modem program code is untouched and
  344. untested, so there may be bugs, of course.
  345.  
  346.    The command line editing, history ability, definable paths, chain
  347. characters, redirection capabilities, improvements in definable prompts,
  348. recursive directory command, more command, and set command were implemented
  349. by Rick Wirch.  I also fixed bugs and generally rewrote the the cd, copy,
  350. define, dir, newcli, and type commands to improve their performance and
  351. abilities.  Finally, I ran a fine-toothed comb through the code and reduced
  352. the size of the executable from about 40K in its original form to its
  353. current 17K ( with the help of AZTEC 'C' ) and in the process removed all
  354. the bugs ( I hope ).
  355.  
  356. P.S.  I use MyCLI every day on the average of four hours per day and I have
  357. not found any bugs in it with the exception of Execute() and its creaping
  358. featureisms.
  359.  
  360. Version 1.00 by Mike Schwartz, 344 Fay Way, Mt. View CA 94043
  361.  
  362. Version 2.0  by Rick Wirch, 1009 Vilas Ave. #2, Madison, WI 53715
  363.